package cn.edu.cqu.fredyvia.forum.entity;

import java.util.Date;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author fredyvia
 * @since 2021-07-10
 */
@Data
@TableName("talk_thumb")
public class TalkThumb extends Model<TalkThumb> {

    private static final long serialVersionUID = 1L;

    public TalkThumb(Integer userId,Integer talkId){
        this.userId=userId;
        this.talkId=talkId;
    }
    /**
     * 点赞人的id
     */
    @TableId("user_id")
    private Integer userId;
    /**
     * 点赞的话题id
     */
    @TableField("talk_id")
    private Integer talkId;
    /**
     * 点赞时间
     */
    @TableField(value="create_datetime")
    private Date createDatetime;


    @Override
    public Serializable pkVal() {
        return this.userId.toString()+this.talkId.toString();
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
